<?
require_once("conn.php");
$cat_id = $_REQUEST["cat_id"];
		
?>
<table>
	<tr>
		<td><a href="#" onclick="frmNewLogoshop()">New Product</a></td>
		<td> | </td>
		<td><a href="#" onclick="frmBuyStock()">Buy Stock</a></td>
	</tr>
</table><br>
<span>Category : </span>
<select id="catLogo" onchange="updateLogoMain()">
	<option value="0">All</option>
	<?
		$sql = "SELECT * FROM category;";
		$qry = mysql_query($sql);
		while($row = mysql_fetch_array($qry)){
			if($row["Cat_ID"] == $cat_id){
				$sel = "selected";
			}else{
				$sel = "";
			}
		?>
			<option value="<?=$row["Cat_ID"]?>" <?=$sel?>><?=$row["Category_Name"]?></option>
		<?
		}
	?>
</select><br>
<table width="750">
	<tr>
		<td colspan="7"><span align="right" style="float:right;" ><a href="stock_logoshopexcel.php?cat_id=<?=$cat_id?>" target="_blank"><img src="images/excel_icon.jpg" width="25" border="0"></a></span></td>
	</tr>
</table>
<br>
<table width="100%" border="1" style="border-collapse:collapse">
	<tr>
		<td>Barcode</td>
		<td>Category</td>
		<td>Product Name</td>
		<td>Qty</td>
		<td>Price</td>
		<td>&nbsp;</td>
	</tr>
	<?
		if($cat_id != "" && $cat_id != "0"){
			$where = "WHERE Category='".$cat_id."'";
		}else{
			$where = "";
		}

		$sql = "select * from stock join category on category=Cat_ID $where ORDER by category,barcode;";
		$query = mysql_query($sql) or die(mysql_error());
		while($row = mysql_fetch_array($query)){
		?>
			<tr>
				<td><?=$row["Barcode"]?></td>
				<td><?=$row["Category_Name"]?></td>
				<td><?=$row["Product_Name"]?></td>
				<td><?=$row["Qty"]?></td>
				<td><?=$row["Price"]?></td>
				<td align="center">&nbsp;<a href="#" onclick="frmeditLogo('<?=$row["Barcode"]?>')">edit</a>&nbsp;<a href="#" onclick="delStock('<?=$row["Barcode"]?>')">del</a>&nbsp;</td>
			</tr>
		<?
		}
	?>
</table>
<div id="dialogEditLogo" style="display:none;"></div>